package com.CoreryBlack.Mapper;

import com.CoreryBlack.po.Emp;
import com.CoreryBlack.po.EmpQueryParam;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * @Description EmpMapper
 * @Author CoreryBlack
 * @Date 2024-09-20
 */
@Mapper
public interface EmpMapper {
    Page<Emp> list(EmpQueryParam empQueryParam);


    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert into emp (username,password,name,gender,phone,job,salary,image,entry_date,dept_id,create_time,update_time) values " +
            "(#{username},#{password},#{name},#{gender},#{phone},#{job},#{salary},#{image},#{entryDate},#{deptId},#{createTime},#{updateTime})")
    void insert(Emp emp);


    void deleteById(List<Integer> ids);

    Emp getById(Integer id);

    void update(Emp emp);

    List<Map> empJobData();

    List<Map<String,Integer>> empGenderData();
    @Select("select id, username, password, name, gender, phone, job, salary, image, entry_date, dept_id, create_time, update_time from emp")
    public List<Emp> findAll();


    Emp getNameAndPassword(Emp emp);
}
